package com.yzy.fly.type;

import lombok.Getter;
import lombok.Setter;

public enum MYSQLEngineType {
    ARCHIVE("ARCHIVE",""),
    BLACKHOLE("BLACKHOLE",""),
    CSV("CSV",""),
    INNODB("InnoDB",""),
    MEMORY("MEMORY", ""),
    MRG_MYISAM("MRG_MYISAM", ""),
    MYLSAM("MylSAM", ""),
    PERFORMANCE_SCHEMA("PERFORMANCE_SCHEMA", "");

    @Setter
    @Getter
    private String type;
//    @Setter
//    @Getter
//    private String value;
    @Setter
    @Getter
    private String desc;

    MYSQLEngineType(String type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public static MYSQLEngineType type(String type) {
        MYSQLEngineType fieldType = null;
        MYSQLEngineType[] values = MYSQLEngineType.values();
        try {
            for (int i = 0; i < values.length; i++) {
                MYSQLEngineType value = values[i];
                if (value.getType().equals(type)) {
                    fieldType = value;
                    break;
                }
            }
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
            fieldType = null;
        }
        return fieldType;
    }


}
